using System.ComponentModel;

namespace GuitarChordFinder
{
    public class ChordAudio : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private Note note;
        private string audioFile = string.Empty;
        private ChordType chordType;

        public ChordType ChordType
        {
            get { return chordType; }
            set
            {
                chordType = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("ChordType"));
                    PropertyChanged(this, new PropertyChangedEventArgs("AudioFileSource"));
                }
            }
        }

        public Note Note
        {
            get { return note; }
            set
            {
                note = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Note"));
                    PropertyChanged(this, new PropertyChangedEventArgs("AudioFileSource"));
                }
            }
        }

        public string AudioFile
        {
            get { return audioFile; }
            set
            {
                audioFile = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("AudioFile"));
                    PropertyChanged(this, new PropertyChangedEventArgs("AudioFileSource"));
                }
            }
        }

        public string AudioFileSource
        {
            get { return ("GuitarChordFinder;component/sounds/" + this.AudioFile); }
            //PAPA - If you want to stream the audio instead, use the following line of code
            //get { return ("http://localhost:7087/sounds/" + this.AudioFile); }
        }
    }
}